﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Intarstructure.Imtarment
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 无条件查询
        /// </summary>
        /// <returns></returns>
        IQueryable<T> AllShow();
        /// <summary>
        /// 多条件查询
        /// </summary>
        /// <returns></returns>
        IQueryable<T> AllShow(Expression<Func<T, bool>> expression);
        /// <summary>
        /// 单条件查询
        /// </summary>
        /// <returns></returns>
        Task<T> OnlyShow(Expression<Func<T, bool>> expression);
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
         Task<int> AsyncAdd(T item);
         /// <summary>
         /// 修改
         /// </summary>
         /// <param name="item"></param>
         /// <returns></returns>
        Task<int> AsyncUpdate(T item);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        Task<int> AsyncDelete(T item);
        /// <summary>
        /// 批量新增
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        Task<int> AsyncAdd(List<T> item);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        Task<int> AsyncUpdate(List<T> item);
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        Task<int> AsyncDelete(List<T> item);


    }
}
